<template>
  <div class="h100 sysLogPage">
    <div class="sysLogSearch table-page-search-wrapper">
      <syncLog-search @clickbtn="handleClickSearchBtn"></syncLog-search>
    </div>
    <div class="sysLogMain">
      <syncLog-table-list ref="sysLogMainComp" @clickbtn="handleMainCompClick"></syncLog-table-list>
    </div>
  </div>
</template>
<script>
import { mapGetters, mapState } from 'vuex'
import SyncLogSearch from './components/SyncLogSearch.vue'
import SyncLogTableList from './components/SyncLogTableList.vue'
export default {
  components: {
    SyncLogSearch,
    SyncLogTableList
  },
  computed: {
    ...mapState({
      queryParams: (state) => state.syncLog.queryParams
    }),
    ...mapGetters(['myActiveProjectId'])
  },
  data() {
    return {
      nowTime: 156789
    }
  },
  created() {
    this.getPageDictData()
  },
  methods: {
    handleClickSearchBtn(data) {
      this.nowTime = new Date().getTime()
      if (this[data.type]) {
        this[data.type](data)
      }
    },
    handleMainCompClick(data) {
      this.nowTime = new Date().getTime()
      if (this[data.type]) {
        this[data.type](data.data)
      }
    },
    searchData(isToFirstPage) {
      this.$refs.sysLogMainComp.refreshData(isToFirstPage)
    },
    getPageDictData() {
      ['getSystemLogTypeDictCodeData'].forEach(method => {
        this.$store.dispatch(method)
      })
    }
  },
  beforeDestroy() {
    this.$store.commit('resetSysLogQueryParams')
  }
}
</script>
<style lang="less" scoped>
@import url('./style/list.less');
</style>
